package org.entity;

import org.junit.Test;

import java.util.*;

public class Main {
    @Test
    public void test() {
        int temp = -1;
        String[] strs = {"aaa", "ccc", "ddd", "eee", "fff", "ggg"};
        for (int i = 0; i < strs.length - 1; i++) {
            if (strs[i].equals("ddd")) {
                temp = i;
            }
            if (temp != -1) {
                strs[i] = strs[++temp];
            }
            if (strs.length - 1 == temp) {
                strs[temp] = null;
            }
        }
        for (String q : strs) {
            System.out.print(q + " ");
        }
    }
}